/**
 * 消息类型常量定义
 * 统一管理所有消息类型，避免重复定义
 */

// 消息类型枚举
export const MESSAGE_TYPES = {
  TEXT: 0,
  IMAGE: 1,
  FILE: 2,
  POSTCARD: 3,
  VOICE_CALL: 4,
  VIDEO_CALL: 5,
  VOICE_MSG: 6,
  TRANSFER: 7,
  APP_LINK: 10,
  QUOTE: 11
};

// 消息类型标签映射
export const MESSAGE_TYPE_LABELS = {
  [MESSAGE_TYPES.TEXT]: '文本消息',
  [MESSAGE_TYPES.IMAGE]: '图片消息',
  [MESSAGE_TYPES.FILE]: '文件消息',
  [MESSAGE_TYPES.POSTCARD]: '名片消息',
  [MESSAGE_TYPES.VOICE_CALL]: '语音通话',
  [MESSAGE_TYPES.VIDEO_CALL]: '视频通话',
  [MESSAGE_TYPES.VOICE_MSG]: '语音消息',
  [MESSAGE_TYPES.TRANSFER]: '转账消息',
  [MESSAGE_TYPES.APP_LINK]: '应用链接',
  [MESSAGE_TYPES.QUOTE]: '引用消息'
};

// 消息操作命令
export const MESSAGE_COMMANDS = {
  COPY: '1',
  RETRACT: '2',
  DELETE: '3',
  QUOTE: '4',
  EDIT: '5',
  FORWARD: '6'
};

// 消息操作标签
export const MESSAGE_COMMAND_LABELS = {
  [MESSAGE_COMMANDS.COPY]: '复制',
  [MESSAGE_COMMANDS.RETRACT]: '撤回',
  [MESSAGE_COMMANDS.DELETE]: '删除',
  [MESSAGE_COMMANDS.QUOTE]: '引用',
  [MESSAGE_COMMANDS.EDIT]: '编辑',
  [MESSAGE_COMMANDS.FORWARD]: '转发'
};

// 消息状态
export const MESSAGE_STATUS = {
  SENDING: 'sending',
  SENT: 'sent',
  DELIVERED: 'delivered',
  READ: 'read',
  FAILED: 'failed',
  RETRACTED: 'retracted'
};

// 消息状态标签
export const MESSAGE_STATUS_LABELS = {
  [MESSAGE_STATUS.SENDING]: '发送中',
  [MESSAGE_STATUS.SENT]: '已发送',
  [MESSAGE_STATUS.DELIVERED]: '已送达',
  [MESSAGE_STATUS.READ]: '已读',
  [MESSAGE_STATUS.FAILED]: '发送失败',
  [MESSAGE_STATUS.RETRACTED]: '已撤回'
};

// 消息操作权限
export const MESSAGE_PERMISSIONS = {
  CAN_RETRACT: 'can_retract',
  CAN_EDIT: 'can_edit',
  CAN_DELETE: 'can_delete',
  CAN_QUOTE: 'can_quote',
  CAN_FORWARD: 'can_forward'
};

// 时间相关常量
export const TIME_CONSTANTS = {
  RETRACT_TIME_LIMIT: 2 * 60 * 1000, // 2分钟撤回限制
  EDIT_TIME_LIMIT: 2 * 60 * 1000,    // 2分钟编辑限制
  TYPING_INDICATOR_TIMEOUT: 3000,    // 3秒打字指示器超时
  MESSAGE_TIMEOUT: 30000             // 30秒消息超时
};

// 默认配置
export const DEFAULT_CONFIG = {
  MESSAGE_BATCH_SIZE: 10,
  MESSAGE_BATCH_DELAY: 50,
  SCROLL_THROTTLE_DELAY: 100,
  DEBOUNCE_DELAY: 300,
  MAX_MESSAGE_LENGTH: 1000,
  MAX_FILE_SIZE: 10 * 1024 * 1024, // 10MB
  SUPPORTED_IMAGE_TYPES: ['jpg', 'jpeg', 'png', 'gif', 'webp'],
  SUPPORTED_FILE_TYPES: ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt']
};

export default {
  MESSAGE_TYPES,
  MESSAGE_TYPE_LABELS,
  MESSAGE_COMMANDS,
  MESSAGE_COMMAND_LABELS,
  MESSAGE_STATUS,
  MESSAGE_STATUS_LABELS,
  MESSAGE_PERMISSIONS,
  TIME_CONSTANTS,
  DEFAULT_CONFIG
};
